package com.airwallex.model;

import java.math.BigDecimal;

/**
 * 表达式具体参数对象
 */
public class ExpParam {
    //字符内容
    private String content;

    //数字值
    private BigDecimal num;

    //在字符串中的位置
    private int pos;

    //是否是数字
    private boolean isNumber;

    ExpParam(String content, BigDecimal num, int pos, boolean isNumber) {
        this.content = content;
        this.num = num;
        this.pos = pos;
        this.isNumber = isNumber;
    }

    public static ExpParamBuilder builder() {
        return new ExpParamBuilder();
    }

    public String getContent() {
        return content;
    }

    public int getPos() {
        return pos;
    }

    public BigDecimal getNum() {
        return num;
    }

    public boolean getIsNumber() {
        return isNumber;
    }


    /**
     * 静态内部类建造者
     */
    public static class ExpParamBuilder {
        private String content;
        private BigDecimal num;
        private int pos;
        private boolean isNumber;

        ExpParamBuilder() {
        }

        public ExpParamBuilder content(String content) {
            this.content = content;
            return this;
        }

        public ExpParamBuilder num(BigDecimal num) {
            this.num = num;
            return this;
        }

        public ExpParamBuilder pos(int pos) {
            this.pos = pos;
            return this;
        }

        public ExpParamBuilder isNumber(boolean isNumber) {
            this.isNumber = isNumber;
            return this;
        }

        public ExpParam build() {
            return new ExpParam(content, num, pos, isNumber);
        }

        public String toString() {
            return "ExpParam.ExpParamBuilder(content=" + this.content + ", num=" + this.num + ", pos=" + this.pos + ", isNumber=" + this.isNumber + ")";
        }
    }
}
